package com.xzlf.controller;

import com.xzlf.pojo.User;
import com.xzlf.service.FirstServiceAPI;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;
import java.util.List;
import java.util.concurrent.TimeUnit;

@RestController
@Slf4j
public class FirstservcieImpl implements FirstServiceAPI {

    @Override
    public List<String> testFeign() {
        try {
            TimeUnit.SECONDS.sleep(2);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        log.info("testFeign() run.....");
        return Arrays.asList("测试springcloud-openfen","此为返回结果");
    }

    @Override
    public User getMultiParams(Integer id, String name) {
        log.info("getMultiParams() run.....");
        User user = new User();
        user.setId(id);
        user.setUsername(name);
        return user;
    }

    @Override
    public User postMultiParams(Integer id, String name) {
        log.info("postMultiParams() run.....");
        User user = new User();
        user.setId(id);
        user.setUsername(name);
        return user;
    }

    @Override
    public User postObjectParam(User pojo) {
        log.info("postObjectParam() run.....");
        return pojo;
    }

    @Override
    public List<User> postObjectList(List<User> userList) {
        return userList;
    }
}
